USER = {}

-- 添加扣除金钱
function USER.add_money(user, val)
    local old = user:get_money()
    local left = old + val
    if val < 0 then
        if left < 0 then
            return 0, old
        end
    end
    user:set_money(left)
    return val, left
end
-- 添加扣除bean
function USER.add_bean(user, val)
    local old = user:get_bean()
    local left = old + val
    if val < 0 then
        if left < 0 then
            return 0, old
        end
    end
    user:set_bean(left)
    return val, left
end

-- 添加扣除金币
function USER.add_gold(user, val)
    local old = user:get_gold()
    local left = old + val
    if val < 0 then
        if left < 0 then
            return 0, old
        end
    end
    user:set_gold(left)
    return val, left
end

function USER.func(user,data)

end


return USER
